package org.cskt.sl.sys.service.impl;

import java.util.List;

import org.cskt.sl.sys.dao.ReplyMapper;
import org.cskt.sl.sys.entity.Reply;
import org.cskt.sl.sys.example.ReplyExample;
import org.cskt.sl.sys.service.ReplyService;
import org.cskt.sl.util.Pager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ReplyServiceImpl implements ReplyService {

	@Autowired
	private ReplyMapper replyMapper;
	
	@Override
	public int countByExample(ReplyExample example) {
		// TODO Auto-generated method stub
		return replyMapper.countByExample(example);
	}

	@Override
	public int deleteReplyById(Integer rgid) {
		// TODO Auto-generated method stub
		return replyMapper.deleteByPrimaryKey(rgid);
	}

	@Override
	public int addReply(Reply record) {
		// TODO Auto-generated method stub
		return replyMapper.insertSelective(record);
	}

	@Override
	public List<Reply> findReplyPageList(ReplyExample example,Pager pager) {
		// TODO Auto-generated method stub
		return replyMapper.selectByExample(example, (pager.getCurrentPage()-1)*pager.getPageSize(), pager.getCurrentPage()*pager.getPageSize());
	}

	@Override
	public Reply getReplyById(Integer rgid) {
		// TODO Auto-generated method stub
		return replyMapper.selectByPrimaryKey(rgid);
	}

	@Override
	public int updateReplyById(Reply record) {
		// TODO Auto-generated method stub
		return replyMapper.updateByPrimaryKey(record);
	}

}
